package main

import (
	"encoding/json"
	"log"
)

//https://juejin.im/post/5b5bd2ddf265da0f716c2fea
//https://juejin.im/search?query=golang

func main() {

	params := make(map[string]string)
	params["id"] = "1"
	params["id1"] = "3"
	params["controller"] = "sections"

	// 转化为 json 为无序列的
	data, _ := json.Marshal(params)
	log.Println(string(data))

	// Json反序列化数字到interface{}类型的值中，默认解析为float64类型
	jsonStr := `{"id":1058,"name":"RyuGou"}`
	var jsonData map[string]interface{}
	json.Unmarshal([]byte(jsonStr), &jsonData)
	log.Printf("jsonData['id']:%T", jsonData["id"])
	sum := jsonData["id"].(float64) + 3
	log.Println(sum)

}
